package com.lywz.biz.dao.food.impl;

import java.util.List;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.lywz.biz.common.dao.AbstractBaseDao;
import com.lywz.biz.common.entity.goodfood.SpecialSnack;
import com.lywz.biz.dao.food.SpecialSnackDao;
import com.lywz.core.util.CommonDefaultCheck;

@Repository("specialSnackDao")
public class SpecialSnackDaoImpl extends AbstractBaseDao implements SpecialSnackDao {

    /* (non-Javadoc)
     * @see com.lywz.biz.dao.food.SpecialSnackDao#getSpecialSnackListByPower(int)
     */
    @SuppressWarnings("unchecked")
    @Override
    public List<SpecialSnack> getSpecialSnackListByPower(int limit) throws Exception {
        Query query = session().getNamedQuery("specialSnack.querySnackListByPower");
        query.setMaxResults(limit);
        return (List<SpecialSnack>) CommonDefaultCheck.checkDefault(query.list());
    }

    /* (non-Javadoc)
     * @see com.lywz.biz.dao.food.SpecialSnackDao#getAllSpecialSnackListByPower()
     */
    @SuppressWarnings("unchecked")
    @Override
    public List<SpecialSnack> getAllSpecialSnackListByPower() throws Exception {
        Query query = session().getNamedQuery("specialSnack.querySnackListByPower");
        return (List<SpecialSnack>) CommonDefaultCheck.checkDefault(query.list());
    }

}
